<?php
/*
	
*/
defined('BY_JYA') or exit('Access Denied');
global $_RQ,$_AR;
$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
if($_RQ['op']=='main'){
	/*******main*******/
	$return['member']=cfc('core')->get_member($_SESSION['uid']);
	$return['list']=array();
	set_html('title',$basic['title']?'首页-'.$basic['title']:'首页');
	$setting = $this->plugin_setting('basic');
	$return['sharedata']=array(
		'title'=>$setting['share_title']?$setting['share_title']:'首页-在线教育',
		'desc'=>$setting['share_desc']?$setting['share_desc']:'在线教育，一个属于自己的在线教育！',
		'link'=>custom_url('jy_edu/index//fromuser='.$_SESSION['uid'],true),
		'imgUrl'=>ATTACHMENT_URL.$setting['share_image']
	);
	$return['params']=array();
	exi($return);
}
if($_RQ['op']=='getlist'){
	$return['params']=array();
	$params=array('uniacid'=>$_SESSION['uniacid'],'status'=>1);
	if($_RQ['keyword']){
		if(is_numeric($_RQ['keyword'])){
			$params['id']=intval($_RQ['keyword']);
			$return['params']['id']=intval($_RQ['keyword']);
		}else{
			$params['title like']='%'.$_RQ['keyword'].'%';
			$return['params']['title']=$_RQ['keyword'];
		}
	}
		
	//按点赞数排序作品
	$pindex = max(1, intval($_RQ['page']));
	$psize = 10;
	$list=pdo_getslice('jy_edu_lesson',$params,array($pindex,$psize),$total,$fields,'','id desc');
	if($list){
		$sum=count($list);
		foreach($list as &$item){
		}
	}
	$return['list']=$list;
	$return['params']['page'] =$pindex;
	$return['reply']=$reply;
	$return['intDiff']=$reply['endtime']- time();
	$return['endstatus']= $reply['endtime'] < time()? 2 : $reply['starttime'] <time()?1:0;
	$return['apstatus']= $reply['apendtime'] < time()? 2 : $reply['apstarttime'] <time()?1:0;
	exi($return);
}
if($_RQ['op']=='getall'){
	$return['params']=array();
	$params=array('uniacid'=>$_SESSION['uniacid']);		
	//按点赞数排序作品
	$pindex = max(1, intval($_RQ['page']));
	$psize = 10;
	$fields=array('id','uniacid','title','pic_url');
	$notices=pdo_getslice('core_account_article',$params,array($pindex,$psize),$total,$fields,'','id desc');
	$return['list']=$list;
	$return['notices']=$notices;
	$return['params']['page'] =$pindex;
	$return['reply']=$reply;
	$return['intDiff']=$reply['endtime']- time();
	$return['endstatus']= $reply['endtime'] < time()? 2 : $reply['starttime'] <time()?1:0;
	$return['apstatus']= $reply['apendtime'] < time()? 2 : $reply['apstarttime'] <time()?1:0;
	exi($return);
}
if($_RQ['op']=='getprovince'){
	$return['province']=file_get_contents('core/resource/area.txt');
	$return['province']=unserialize($return['province']);
	exi($return);
}